package com.hyjy.music.base

import androidx.viewbinding.ViewBinding
import androidx.appcompat.app.AppCompatActivity
import android.os.Bundle
import android.view.LayoutInflater
import android.view.Window

/**
 * Activity基类
 */
abstract class BaseActivity<VB : ViewBinding> : AppCompatActivity() {
    protected var binding: VB? = null

    override fun onCreate(savedInstanceState: Bundle?) {
        super.onCreate(savedInstanceState)
        supportRequestWindowFeature(Window.FEATURE_NO_TITLE) // 去标题栏
        binding = initViewBinding(LayoutInflater.from(this))
        setContentView(binding?.root)
    }

    protected abstract fun initViewBinding(layoutInflater: LayoutInflater): VB

    override fun onDestroy() {
        super.onDestroy()
        binding = null
    }
}